In [16]:
import pandas as pd
import plotly.express as px
from IPython.display import HTML
# Load the data
data = pd.read_pickle('jmu_reddit_geoparsed_long.pickle')
# Create a scatter map plot
fig = px.scatter_map(data, lat="latitude", lon="longitude", hover_name="place",
color_discrete_sequence=["fuchsia"], zoom=4, height=600)
fig.update_layout(map_style="open-street-map")
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
# Show the figure (this works in Jupyter)
fig.show()
# Also create HTML version that works in exported HTML
html_div = fig.to_html(include_plotlyjs=True, div_id="location-map")
display(HTML(html_div))